//
//  main.m
//  XMLBuilder
//
//  Created by shchen on 16/4/5.
//  Copyright © 2016年 shchen. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "XMLBuilder.h"
int main(int argc, const char * argv[]) {
    @autoreleasepool {
        //通过节点构造XML
        XMLElement *category=[XMLElement elementWithString:@"Category"];
        XMLElement *categoryList=[XMLElement elementWithString:@"CategoryList"];
        [category addElementAttritudeForElementAttritudeKey:@"ID" forValue:@"01"];
        XMLElement *MainCategory=[XMLElement elementWithString:@"MainCategory" content:@"XML"];
        XMLElement *Description=[XMLElement elementWithString:@"Description" content:@"this is a list my XML articles."];
        XMLElement* Active=[XMLElement elementWithString:@"Active" content:@"true"];
        [categoryList addChildElement:category];
        [category addChildElement:MainCategory];
        [category addChildElement:Description];
        [category addChildElement:Active];
        //生成XML文档
        NSString *XMLDocument=[XMLBuilder buildByRootXMLElement:categoryList];
        NSLog(@"\n%@",XMLDocument);
    }
    return 0;
}
